var app = getApp();

Page({
  data: {
  },
  onLoad: function() {
    
  },
  onShow: function() {
    var that = this;
    var url = getCurrentPages()[0].route;
    var userInfo = app.globalData.userInfo;
    if (userInfo == null) {
      wx.setStorage({
        key: 'lastpage',
        data: url,
      })
      wx.redirectTo({
        url: '/pages/wode/login/login',
      })
    } else {
      this.setData({
        userInfo: userInfo,
      })
    }
  },
  go: function() {
    wx.navigateTo({
      url: '/pages/wode/login/login',
    })
  },
  exit: function() {
    wx.showModal({
      title: '提示',
      content: '是否确定退出登录？',
      success(res) {
        if (res.confirm) {
          app.globalData.userInfo = null;
          wx.clearStorage();
          var url = getCurrentPages()[0].route;
          wx.setStorage({
            key: 'lastpage',
            data: url,
          })
          wx.redirectTo({
            url: '/pages/wode/login/login',
          })
        }
      }
    })
  }
})